package com.none.staff.view.dialog;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;

import com.none.staff.R;

public class TipMessageDialogUtil {

    private Context context;
    private AlertDialog dialog;
    public AlertDialog.Builder builder = null;

    @SuppressLint("StaticFieldLeak")

    public TipMessageDialogUtil(Context context) {
        this.context = context;
    }

    public TipMessageDialogUtil createTipDialog(String title, String msg) {
        builder = new AlertDialog.Builder(context);
        builder.setIcon(R.mipmap.ic_launcher);
        builder.setTitle(title);
        builder.setMessage(msg);
        builder.setCancelable(false);
        return this;
    }

    public void show() {
        dialog = builder.create();
        if (dialog != null && !dialog.isShowing()) {
            dialog.show();
        }
    }

    public void dismiss() {
        if (dialog != null && dialog.isShowing()) {
            dialog.dismiss();
        }
    }

}
